<?php


namespace App\Http\Middleware;

use Closure;
use App\Http\Controllers\BaseController;
use Illuminate\Support\Facades\Cache;

class Auth extends BaseController
{
    public function handle($request, Closure $next, $type)
    {
        //判断是否是管理员
        if ($request->cache_data['is_admin'] != $type){
            return $this->returnJson(BaseController::UNAUTHORIZED, 'user credentials are invalid');
        }
        return $next($request);
    }
}
